package com.youlai.boot.system.model.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.youlai.boot.system.enums.MenuTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 菜单实体
 *
 * @author Ray
 * @since 2023/3/6
 */
@Getter
@Setter
@Accessors(chain = true)
@Table(value = "sys_menu")
public class SysMenuEntity {
    @Schema(description = "主键ID")
    @Id(keyType = KeyType.Auto)
    private Long id;

    @Schema(description = "父菜单ID")
    @Column(value = "parent_id")
    private Long parentId;

    @Schema(description = "菜单名称")
    @Column(value = "name")
    private String name;

    @Schema(description = "菜单类型(1-菜单；2-目录；3-外链；4-按钮权限)")
    @Column(value = "type")
    private MenuTypeEnum type;

    @Schema(description = "路由名称（Vue Router 中定义的路由名称）")
    @Column(value = "route_name")
    private String routeName;

    @Schema(description = "路由路径（Vue Router 中定义的 URL 路径）")
    @Column(value = "route_path")
    private String routePath;

    @Schema(description = "组件路径(vue页面完整路径，省略.vue后缀)")
    @Column(value = "component")
    private String component;

    @Schema(description = "权限标识")
    @Column(value = "perm")
    private String perm;

    @Schema(description = "显示状态(1:显示;0:隐藏)")
    @Column(value = "visible")
    private Integer visible;

    @Schema(description = "排序")
    @Column(value = "sort")
    private Integer sort;

    @Schema(description = "菜单图标")
    @Column(value = "icon")
    private String icon;

    @Schema(description = "跳转路径")
    @Column(value = "redirect")
    private String redirect;

    @Schema(description = "父节点路径，以英文逗号(,)分割")
    @Column(value = "tree_path")
    private String treePath;

    @Schema(description = "【菜单】是否开启页面缓存(1:开启;0:关闭)")
    @Column(value = "keep_alive")
    private Integer keepAlive;

    @Schema(description = "【目录】只有一个子路由是否始终显示(1:是 0:否)")
    @Column(value = "always_show")
    private Integer alwaysShow;

    @Schema(description = "路由参数")
    @Column(value = "params")
    private String params;

    @Schema(description = "创建时间")
    @Column(value = "created_at", onInsertValue = "now()")
    private Date createdAt;

    @Schema(description = "更新时间")
    @Column(value = "updated_at", onInsertValue = "now()", onUpdateValue = "now()")
    private Date updatedAt;
}